<?php namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Match extends Model
{
    protected $fillable = ['find_item_id', 'lost_item_id', 'match_user_id', 'confirm', 'confirm_user_id'];

    public function findItem()
    {
        return $this->hasOne('App\Models\Item', 'id', 'find_item_id');
    }

    public function lostItem()
    {
        return $this->hasOne('App\Models\Item', 'id', 'lost_item_id');
    }

    public function confirmUser()
    {
        return $this->belongsTo('App\User', 'confirm_user_id', 'id')->withTrashed();
    }

}